package com.xinzhi.user.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xinzhi.user.entity.UserLikeVideosEntity;
import com.xinzhi.user.service.UserLikeVideosService;
import com.xinzhi.common.utils.PageUtils;
import com.xinzhi.user.R;



/**
 * 
 *
 * @author song
 * @email s85201001@163.com
 * @date 2022-01-07 09:04:23
 */
@RestController
@RequestMapping("user/userlikevideos")
public class UserLikeVideosController {
    @Autowired
    private UserLikeVideosService userLikeVideosService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("user:userlikevideos:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = userLikeVideosService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("user:userlikevideos:info")
    public R info(@PathVariable("id") Integer id){
		UserLikeVideosEntity userLikeVideos = userLikeVideosService.getById(id);

        return R.ok().put("userLikeVideos", userLikeVideos);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("user:userlikevideos:save")
    public R save(@RequestBody UserLikeVideosEntity userLikeVideos){
		userLikeVideosService.save(userLikeVideos);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("user:userlikevideos:update")
    public R update(@RequestBody UserLikeVideosEntity userLikeVideos){
		userLikeVideosService.updateById(userLikeVideos);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("user:userlikevideos:delete")
    public R delete(@RequestBody Integer[] ids){
		userLikeVideosService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
